$(function () {
    $.ajax({
        type: "post",
        url: "/findExam",
        dataType:"json",
        success:function(data){
            for (let i=0; i<data.length-1; i++) {
                let sex = null;
                if (data[i].sex == 'M') {
                    sex = "男"
                }
                if (data[i].sex == 'F') {
                    sex = "女"
                }
                for (let j = i+1; j < data.length; j++) {

                    let test = null;
                    if (data[i].age - data[j].age >= 20) {
                        test = "父子，母子"
                    }
                    if (data[i].age - data[j].age < 20) {
                        test = "兄弟姐妹"
                    }
                    if (data[i].age - data[j].age > 30) {
                        test = "祖孙关系"
                    }
                    var $tr = $("<tr>"+
                        "<td>" + data[i].name + "</td>," +
                        "<td>" + sex + "</td>," +
                        "<td>" + data[i].age + "</td>,"+
                        "<td>" + data[j].name + "</td>," +
                        "<td>" + sex + "</td>," +
                        "<td>" + data[j].age + "</td>," +
                        "<td>" + test + "</td>,"+
                        "</tr>"
                    )
                    $("#table1").append($tr);
                }

            }
        },error:function (e){
            alert("请求错误");
        }
    })
})